# -*- coding: utf-8 -*-
# @Author : 17
# @Time    : 2024/4/24 15:05
# @File    : add_bug_notice.py
from mysql.mysql_conn import MysqlDB


def add_bug() -> list:
    BUGS = []
    """查询所有项目中未关闭的bug（不包含延期处理）"""
    sql = "SELECT b.id , b.title, b.PRJ ,b.severity, b.product , b.pri, u.realname, u.mobile, u1.realname as openName FROM zt_bug b \
    LEFT JOIN zt_user u ON b.assignedTo = u.account LEFT JOIN zt_user u1 ON b.openedBy = u1.account  \
    WHERE b.openedDate between date_add(now(), interval - 1 minute) and now()"
    bugsCount = MysqlDB().fetch_all(sql)
    BUGS.append(bugsCount)
    return BUGS
